PROGRAM main
  VAR
    // 传感信号
    bSignal AT %IX1.0 : BOOL;
    // 消除抖动后的信号
    bStableSignal : BOOL;
    // 定时器
    aTon : TON;
  END_VAR

  VAR CONSTANT
    // 延时时间
    tDelay : TIME := T#200ms;
  END_VAR

 bStableSignal := bSignal OR (bStableSignal AND NOT aTon.Q);
 aTon(IN := bStableSignal, PT := tDelay);
END_PROGRAM
